<template>
    <TablePro v-bind="tableConfig" />
</template>

<script setup>

    import TablePro from '@/components/TablePro.vue';
    import { getGroup } from '@/apis/book';
    import { reactive } from 'vue';
    import { useRouter } from 'vue-router'

    const router = useRouter()

    const tableConfig = reactive({
    // 传递方法
    apiData: getGroup,
    fields: { group_id: '群号码',group_name:'群名称', group_level: '群等级', member_count: '群人数', max_member_count: '群容量',group_create_time:'群创建时间'},
    custom: {
        group_create_time: {
            label: (scope) => {
                return scope.row.group_create_time == 0 ? '-' : new Date(scope.row.group_create_time * 1000).toLocaleString();
            },
        }
    },
    options: [
        {
            key: 'edit',
            label: '查看群员列表',
            type: 'primary',
            click: (scope) => {
                router.push(`/book/group/member/${scope.row.group_id}`)
            }
        }
    ]
})
</script>